const express = require("express");
const router = express.Router();
const rolesController = require("../controller/roles");

router
  .post("/addRole", rolesController.addRole)
  .get("/getRole/:id", rolesController.getRole)
  .get("/getRoles", rolesController.getRoles)
  .delete("/delRole", rolesController.delRole)
  .put("/editRole", rolesController.editRole)
  // 获取当前角色下的用户列表
  .get("/getUsersByRole", rolesController.getUsersByRole)
  // 获取当前角色下不包含的所有用户
  .get("/getUsersExclude", rolesController.getUsersExclude)
  // 为当前角色添加用户
  .post("/addUsersToRole", rolesController.addUsersToRole)
  // 将当前角色下的指定用户删除
  .delete("/delUserFormRole", rolesController.delUserFormRole)
  // 授权
  .post("/setAuth", rolesController.setAuth)
  // 权限回显
  .get("/getAuth/:id", rolesController.getAuth);

module.exports = router;
